const app = getApp()

Component({
  data: {
    selected: 0,
    "color": "#797979",
    "selectedColor": "#17BB89",
    "borderStyle": "black",
    "fontSize": "24rpx",
    "backgroundColor": "#fff",
    "list": [
      {
        "pagePath": "/pages/home/index/index",
        "iconPath": "../images/icon7.png",
        "selectedIconPath": "../images/icon7.png",
        "text": "首页"
      },
      {
        "pagePath": "/pages/farm/index/index",
        "iconPath": "../images/time.png",
        "selectedIconPath": "../images/time.png",
        "text": "农事安排"
      },
      {
        "pagePath": "/pages/virus_recognition/index/index",
        "iconPath": "../images/icon4.png",
        "selectedIconPath": "../images/icon4.png",
        "text": "病毒识别"
      },
      {
        "pagePath": "/pages/cultivate/index/index",
        "iconPath": "../images/loT.png",
        "selectedIconPath": "../images/loT.png",
        "text": "勤耕物联"
      },
      {
        "pagePath": "/pages/my/index/index",
        "iconPath": "../images/my.png",
        "selectedIconPath": "../images/my.png",
        "text": "我的"
      }
    ]
  },

  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      // this.setData({
      //   selected: data.index
      // })
      app.globalData.selected = data.index
      wx.switchTab({url})
    }
  }
})